/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package job.manager.db.ec;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "Users")
@NamedQueries({@NamedQuery(name = "UsersEB.findAll", query = "SELECT u FROM UsersEB u"), @NamedQuery(name = "UsersEB.findById", query = "SELECT u FROM UsersEB u WHERE u.id = :id"), @NamedQuery(name = "UsersEB.findByUserName", query = "SELECT u FROM UsersEB u WHERE u.userName = :userName"), @NamedQuery(name = "UsersEB.findByPassword", query = "SELECT u FROM UsersEB u WHERE u.password = :password"), @NamedQuery(name = "UsersEB.findByEmail", query = "SELECT u FROM UsersEB u WHERE u.email = :email"), @NamedQuery(name = "UsersEB.findByIsAdmin", query = "SELECT u FROM UsersEB u WHERE u.isAdmin = :isAdmin"), @NamedQuery(name = "UsersEB.findByProfileId", query = "SELECT u FROM UsersEB u WHERE u.profileId = :profileId"), @NamedQuery(name = "UsersEB.findByUserAndPassword", query = "SELECT u FROM UsersEB u where u.password = :password and u.userName = :userName")})
public class UsersEB implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "userName")
    private String userName;
    @Basic(optional = false)
    @Column(name = "password")
    private String password;
    @Basic(optional = false)
    @Column(name = "email")
    private String email;
    @Basic(optional = false)
    @Column(name = "isAdmin")
    private boolean isAdmin;
    @Column(name = "profileId")
    private Integer profileId;
    @JoinColumn(name = "usergroup", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private UserGroupsEB usergroup;

    public UsersEB() {
    }

    public UsersEB(Integer id) {
        this.id = id;
    }

    public UsersEB(Integer id, String userName, String password, String email, boolean isAdmin) {
        this.id = id;
        this.userName = userName;
        this.password = password;
        this.email = email;
        this.isAdmin = isAdmin;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public boolean getIsAdmin() {
        return isAdmin;
    }

    public void setIsAdmin(boolean isAdmin) {
        this.isAdmin = isAdmin;
    }

    public Integer getProfileId() {
        return profileId;
    }

    public void setProfileId(Integer profileId) {
        this.profileId = profileId;
    }

    public UserGroupsEB getUsergroup() {
        return usergroup;
    }

    public void setUsergroup(UserGroupsEB usergroup) {
        this.usergroup = usergroup;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UsersEB)) {
            return false;
        }
        UsersEB other = (UsersEB) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "job.manager.db.ec.UsersEB[id=" + id + "]";
    }

}
